package com.training.dto;

public class Employee {
	public String name;
	private String grade;
	private String id;
	private int serviceYears;
	private int hourPayRate;
	private int numberOfWorkHours;
	private int commission;

	public Employee() {

		this.numberOfWorkHours = 40;

	}

	public Employee(int commissionInput) {
		commission = commissionInput;

	}

	public Employee(int numberOfHours, int hourPayRate) {
		this.numberOfWorkHours = numberOfHours;
		this.hourPayRate = hourPayRate;
	}

	 
	
	public String getName() {

		this.grade = "G3";
		return name;
	}

	public void setGrade(String grade) {
		if (grade.equalsIgnoreCase("G1") || grade.equalsIgnoreCase("G2")) {
			this.commission = 2000;
		}

		this.grade = grade;
	}

	/**
	 * @return the id - Which is Integer
	 */
	public String getId() {
		return id;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(String id) {
		this.id = id;
	}

	/**
	 * @return the serviceYears
	 */
	public int getServiceYears() {
		return serviceYears;
	}

	/**
	 * @param serviceYears
	 *            the serviceYears to set
	 */
	public void setServiceYears(int serviceYears) {
		this.serviceYears = serviceYears;
	}

	/**
	 * @return the hourPayRate
	 */
	public int getHourPayRate() {
		return hourPayRate;
	}

	/**
	 * @param hourPayRate
	 *            the hourPayRate to set
	 */
	public void setHourPayRate(int hourPayRate) {
		this.hourPayRate = hourPayRate;
	}

	/**
	 * @return the numberOfWorkHours
	 */
	public int getNumberOfWorkHours() {
		return numberOfWorkHours;
	}

	/**
	 * @param numberOfWorkHours
	 *            the numberOfWorkHours to set
	 */
	public void setNumberOfWorkHours(int numberOfWorkHours) {
		this.numberOfWorkHours = numberOfWorkHours;
	}

	/**
	 * @return the grade
	 */
	public String getGrade() {

		return grade;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	public int deliverWork() {
		return numberOfWorkHours;
	}

	private int caluclateWeekSalary(int hourPayRate) {
		int basicPay = 0;

		if (this.grade.equalsIgnoreCase("G4")) {
			basicPay = 2000;
		}

		if (this.grade.equalsIgnoreCase("G3")) {
			basicPay = 1500;
		}
		if (this.grade.equalsIgnoreCase("G2")) {
			basicPay = 1000;
		}
		if (this.grade.equalsIgnoreCase("G1")) {
			basicPay = 500;
		}
		return (40 * hourPayRate) + basicPay + commission;

	}

	private int caluclateWeekSalary() {
		int basicPay = 0;

		if (this.grade.equalsIgnoreCase("G4")) {
			basicPay = 2000;
		}

		if (this.grade.equalsIgnoreCase("G3")) {
			basicPay = 1500;
		}
		if (this.grade.equalsIgnoreCase("G2")) {
			basicPay = 1000;
		}
		if (this.grade.equalsIgnoreCase("G1")) {
			basicPay = 500;
		}
		return (40 * hourPayRate) + basicPay + commission;
	}

	
	
	
	////////////////////////////////////////////////////////////////
	
	 
	
	
	
	public int getSalary() {

		return caluclateWeekSalary();
	}

	public int getSalary(int payHourRate) {
		return caluclateWeekSalary(payHourRate);
	}

}